package com.example.paymentsystem.factory;

import com.example.paymentsystem.common.PaymentType;
import com.example.paymentsystem.factory.product.AbstractPaymentProduct;
import com.example.paymentsystem.factory.product.WeChatAppPayment;
import com.example.paymentsystem.factory.product.WeChatH5Payment;

/**
 * @author YiYuan
 * @data 2025/6/25
 * @apoNote
 */
public class WeChatPaymentFactory implements AbstractPaymentFactory {

    @Override
    public AbstractPaymentProduct createPaymentProduct(String type) {

        if (PaymentType.APP.name().equalsIgnoreCase(type)) {
            return new WeChatAppPayment();
        }
        else if (PaymentType.H5.name().equalsIgnoreCase(type)) {
            return new WeChatH5Payment();
        }

        throw new IllegalArgumentException("Unsupported WeChat payment type: " + type);
    }
}
